var app = getApp()
Page({
  data: {
    hasUserInfo: false,
    options:[
      {
        title: '添加基金',
        upperSubtitle: '上副标题',
        lowerSubtitle: '下副标题',
        titlePosition: 'top', 
        percent:"123",
        time:"08-08",
        arrow: true,
        url:"/page/tabBar/addFund/addFund"
      },
    ]
  },
  
  onReady(){
    this.getUserInfo()
  },
  onItemClick(ev) {
    my.navigateTo({
      url: ev.target.dataset.url,
    })
  },
  getUserInfo() {
    my.getAuthCode({
      scopes: 'auth_user',
      fail: (error) => {
        console.error('getAuthCode', error);
      },
      success: () => {
        // do login...
        // then
        my.getAuthUserInfo({
          fail: (error) => {
            console.error('getAuthUserInfo', error);
          },
          success: (userInfo) => {
            console.log(`userInfo:`, userInfo);
            this.setData({
              userInfo,
              hasUserInfo: true,
            });
            // abridge.alert({
            //   title: JSON.stringify(userInfo), // alert 框的标题
            // });
          }
        });
      }
    });
  },
  clear() {
    this.setData({
      hasUserInfo: false,
      userInfo: {}
    })
  }
})
